<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/

$_SESSION["sessdata"]["pagefrom"] = $_SERVER["QUERY_STRING"];
?>

<p class="categoryheader"><?=$pageParams["title"];?></p>

<?
if ($BigDaddy->IsUserAllowedByAction("cron-edit"))
{
	?>
<ul>
	<li><a href="<?=$_SERVER["PHP_SELF"];?>?page=CronEdit&cronID=<?=$_REQUEST["cronID"];?>">Edit this Cron</a></li>
</ul>
<?
}
?>

<div class="orgbar">
<p><b>Cron Options:</b></p>
</div>
<table border="0" cellpaddingg="0" cellspacing="0">
<?
$cronInfo["cronID"] = $cronInfo["ID"];
$BigDaddyDisplay->ShowCronLine($cronInfo);
?>
</table>

<br>
<br>

<table border="0" cellpadding="5" cellspacing="1" width="800">
<tr valign="top">
<td>

<table border="0" cellpadding="5" cellspacing="1" width="400" class="formtable">
<tr valign="top">
	<td class="formfielddesc">CronID:</td>
	<td class="formfield">
		<?=$cronInfo["ID"];?>
	</td>
</tr>
<tr valign="top">
	<td class="formfielddesc">Filename:</td>
	<td class="formfield">
		<?=$cronInfo["filename"];?>
	</td>
</tr>
<tr valign="top">
	<td class="formfielddesc">Server:<br />
	</td>
	<td class="formfield">
		<?
		$aServerInfo = $BigDaddyData->GetServerInfoByID($cronInfo["serverID"]);
		
		echo $aServerInfo["hostname"];
		?>
	
	</td>
</tr>

<tr valign="top">
	<td class="formfielddesc">Notes:<br />
	</td>
	<td class="formfield">
		<?=nl2br($cronInfo["notes"]);?>
	
	</td>
</tr>
</table>

</td>
<td>

	<table border="0" cellpadding="5" cellspacing="1" width="400" class="formtable">
	<tr valign="top">
	<td class="formfielddesc">Categories</td>
	</tr>
	<td class="formfield">
	
	<?
	
	$aCronCategories = $BigDaddyData->GetCronCategoriesByCronID($_REQUEST["cronID"]);
	
	if (is_array($aCronCategories))
	{
		foreach ($aCronCategories as $nIndex => $row)
		{
			echo $row["name"]."<br />";
		}
	}
	?>
	
	
	</td>
	</tr>
	<tr valign="top">
	<td class="formfielddesc">Details</td>
	</tr>
	<td class="formfield">
	
	Warning Threshold: <?=$cronInfo["mon_threshold"];?> seconds<br />
	
	Start Level: <?=$cronInfo["mon_startlevel"];?><br />
	
	<?
	if ($cronInfo["mon_endlevel"]>0)
	{
	?>
	End Level: <?=$cronInfo["mon_endlevel"];?><br />
	<?
	}
	?>
	
	Last Ran Start: <?
	
	if ($cronInfo["last_ranstart"]>0)
	{
		echo get_time_str($cronInfo["last_ranstart"], 2);
	}
	else
	{
		echo "Never";
	}
	?>
	<br />
	
	Last Ran End: <?
	
	if ($cronInfo["last_ranend"]>0)
	{
		echo get_time_str($cronInfo["last_ranend"], 2);
	}
	else
	{
		echo "Never";
	}
	?>
	<br />
	
	Time Taken: <?
	
	if ($cronInfo["last_ranend"]>=$cronInfo["last_ranstart"])
	{
		echo ($cronInfo["last_ranend"]-$cronInfo["last_ranstart"])." seconds";
	}
	else
	{
		echo "Problem app may not have finished";
	}
	?>
	<br />
	
	Current Warning Level: <?
	
		echo $cronInfo["mon_currentlevel"];
	
	?>
	<br />
	
	<?
	if ($cronInfo["mon_currentlevel"]>0)
	{
	?>
		Current Warning Level Set: <?=get_time_str($cronInfo["mon_currentlevelstart"], 2);?>
		<br />
	<?
	}
	?>
	
	
	<?
	if ($cronInfo["mon_lastcheck"]>0)
	{
	?>
		Last Time Warning Actions Performed: <?=get_time_str($cronInfo["mon_lastcheck"], 2);?>
		<br />
	<?
	}
	?>
	<br />
	
	Delayed Until: <?
	
	if ($cronInfo["delayed_until"]>0)
	{
		echo get_time_str($cronInfo["delayed_until"], 2);
	}
	else
	{
		echo "Not Delayed";
	}
	?>
	
	</td>
	</tr>
	</table>

</td>
</tr>
</table>

<br />


